import http from '@/utils/http'

/***
 * @name 获取订单列表
 * @param data.status 0:未支付,1:支付完成
 */
export const getOrderListApi = (data) => {
    return http({
        url: 'shop/transport/order_list',
        method: 'POST',
        data
    })
}

/***
 * @name 获取订单列表
 * @param data.sku_details 商品信息 [ {goods_item_id: '', shop_id: '' , num: '', note:'' } ]
 */
export const createOrderApi = (data) => {
    return http({
        url: 'shop/order/confirm_order_page',
        method: 'POST',
        data
    })
}

/***
 * @name 订单详情
 * @param data.order_id
 */
export const orderDetailApi = (data) => {
    return http({
        url: 'shop/transport/order_detail',
        method: 'POST',
        data
    })
}

/***
 * @name 提交订单
 * @param data.pay_type 支付方式 offline
 * @param data.sku_details 商品信息 [ {goods_item_id: '', shop_id: '' , num: '', note:'' } ]
 * @param data.note 备注
 * @param data.address_id 地址ID
 * @param data.goods_type 传4
 * @param data.sale_mobile 销售人员编码（手机号）
 * @param data.shop_type 店铺类型
 */
export const confirmOrderApi = (data) => {
    return http({
        url: 'shop/order/confirm_order',
        method: 'POST',
        data
    })
}

/***
 * @name 取消订单
 * @param data.order_id
 * @param data.order_cancel_cause 取消原因
 */
export const cancelOrderApi = (data) => {
    return http({
        url: 'shop/transport/cancel_order',
        method: 'POST',
        data
    })
}

/***
 * @name 删除订单
 * @param data.order_id
 */
export const delOrderApi = (data) => {
    return http({
        url: 'shop/order/order_del',
        method: 'POST',
        data
    })
}

/***
 * @name 订单确认收货
 * @param data.order_id
 */
export const takeOrderApi = (data) => {
    return http({
        url: 'shop/transport/take_delivery',
        method: 'POST',
        data
    })
}

/***
 * @name 订单评价
 * @param data.order_id
 * @param data.star 打分
 * @param data.detail 评价内容
 * @param data.img 图片 '1,2,3'
 */
export const evaOrderApi = (data) => {
    return http({
        url: 'shop/order/order_comment',
        method: 'POST',
        data
    })
}

/***
 * @name 订单退款
 * @param data.z_id
 * @param data.order_id
 * @param data.refund_cause 退款原因
 * @param data.transport_status
 * @param data.transport_status
 * @param data.refund_info
 * @param data.refund_img 图片 '1,2,3'
 */
export const refundOrderApi = (data) => {
    return http({
        url: 'shop/transport/refund_apply',
        method: 'POST',
        data
    })
}

/***
 * @name 获取退款原因
 */
export const refundListApi = (data) => {
    return http({
        url: 'shop/transport/refund_cause',
        method: 'GET',
        data
    })
}

/***
 * @name 更换配送方式
 * @param data.order_id
 * @param data.transport_type 提货类型1-邮寄发货2-店铺自提3送至第三方平台仓库
 * @param data.shop_type 3：选择第三方平台仓库WB、OZON、AVito
 * @param data.address_id 1、3：用户收货地址
 * @param data.transport_shop_id 2：店铺仓库
 */
export const switchExpressTypeApi = (data) => {
    return http({
        url: 'shop/transport/change_transport',
        method: 'POST',
        data
    })
}

/***
 * @name 获取仓库
 */
export const getWarehouseApi = (data) => {
    return http({
        url: 'shop/transport/getWarehouse',
        method: 'POST',
        data
    })
}
